package bin_tree.heap.leetcode;

import java.util.*;

/**
 * @author yuisama
 * @date 2023/03/31 20:55
 * Map接口的使用
 **/
public class MapUsage {
    public static void main(String[] args) {
        // 哈希表
        Map<String,String> map = new HashMap<>();
        map.put("及时雨","宋江");
        map.put("智多星","吴用");
        map.put("花和尚","鲁智深");
        map.put("豹子头","林冲");
        map.put("行者","武松");
        // map -> set
        Set<Map.Entry<String,String>> set = map.entrySet();
        for (Map.Entry<String,String> entry : set) {
            System.out.println(entry.getKey() + "=" + entry.getValue());
        }
//        System.out.println(map.get("花和尚"));
//        // null
//        System.out.println(map.get("霹雳火"));
//        map.put("混江龙","苗云超");
//        System.out.println(map.getOrDefault("混江龙","李俊"));
    }
}